package com.dsp.week05.conf;

import com.dsp.week05.model.Demo2;
import com.dsp.week05.model.Demo4;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

/**
 * @author dsp
 * @date 2021-04-18
 */
@Configuration
// 1.xml注入
@ImportResource(value = {"classpath:bean.xml"})
// 2.import 注入
@Import({ Demo4.class })
public class BeanConfig {

    // 3. 声明bean
    @Bean
    public Demo2 demo2(){
        return new Demo2();
    }

    // 4, Demo3.java 通过常用注解自动扫描（@Component等）注入
}
